package com.chixing.day03_oop;

public class Person {
    private String perName;
    private int perAge;
    private String perGender;
    private boolean ifUnMarried;
    public Person(String name,int age,String gender,boolean ifUnMarried){
        this.perName = name;
        this.perAge = age;
        this.perGender = gender;
        this.ifUnMarried = ifUnMarried;
    }
    public boolean ifCanMarry(Person person){
        if(this.ifUnMarried == false||person.ifUnMarried == false)
            return false;
        if(this.perGender == person.perGender)
            return false;
        if((this.perGender =="男"&&this.perAge>=24&&person.perAge>=22)
            ||(person.perGender =="男"&&person.perAge>=24&&this.perAge>=22))
                return true;
        else return false;
    }
}
